// Author: Sivan [sun.sivan@gmail.com]
// Description: base reset and entry styles.
@import "variables";

@mixin hetiBase {
  // 清容器浮动
  @include clear-float();

  // 清容器内首尾元素外边距
  &,
  section,
  td {
    > *:first-child {
      margin-block-start: 0 !important;
    }

    > *:last-child {
      margin-block-end: 0 !important;
    }
  }

  // 定义块级元素样式
  blockquote {
    margin-block-start: $std-block-unit * 0.5;
    margin-block-end: $std-block-unit;
    margin-inline-start: $std-inline-unit * 2;
    margin-inline-end: $std-inline-unit * 2;
    padding-block-start: $std-block-unit * 0.5;
    padding-block-end: $std-block-unit * 0.5;
    padding-inline-start: $std-inline-unit;
    padding-inline-end: $std-inline-unit;
    //border-radius: 4px;
    background-color: hsla(0, 0%, 0%, 0.054);

    @include darkmode-style {
      background-color: hsla(0, 0%, 100%, 0.054);
    }
  }

  figure {
    display: block;
    text-align: center;

    > img {
      display: block;
      margin-inline-start: auto;
      margin-inline-end: auto;
    }
  }

  hr {
    width: 30%;
    height: 1px;
    margin-block-start: $std-block-unit * 2;
    margin-block-end: $std-block-unit * 2 - 1px;
    margin-inline-start: auto;
    margin-inline-end: auto;
    border: 0;
    background-color: hsl(0, 0%, 80%);

    @include darkmode-style {
      background-color: hsl(0, 0%, 25%);
    }
  }

  p {
    margin-block-start: $std-block-unit * 0.5;
    margin-block-end: $std-block-unit;
    text-align: justify;

    @include non-cjk-block {
      text-align: start;
    }
  }

  $format_pre_code: true !default;

  @if $format_pre_code {
    pre {
      margin-block-start: $std-block-unit * 0.5;
      margin-block-end: $std-block-unit * 0.5;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-block-start: $std-block-unit * 0.5;
      padding-block-end: $std-block-unit * 0.5;
      padding-inline-start: $std-inline-unit;
      padding-inline-end: $std-inline-unit;
      overflow: auto;
      font-family: $font-family-mono;
      white-space: pre;
      word-wrap: normal;
      border-radius: 4px;
      background-color: hsla(0, 0%, 0%, 0.054);

      @include darkmode-style {
        background-color: hsla(0, 0%, 100%, 0.054);
      }

      code {
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background-color: transparent;
        color: inherit;
      }
    }
  }
}
